﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;
using BrokerBase.Lib.Product;

namespace brokerbase.lib.product
{
    class ProudctExander : AbstractProductExpander
    {
        public override void Loaded(IPolicy policy)
        {
            IPaymentPeriod bpp = policy.Owner.BasicPolicy.SelectedPaymentPeriod;

            policy.SelectedPaymentPeriod = policy.Product.PaymentPeriods.First(p => p.Style == bpp.Style && p.Value == bpp.Value);

            IInsurancePeriod ipp = policy.Owner.BasicPolicy.SelectedInsurancePeriod;

            policy.SelectedInsurancePeriod = policy.Product.InsurancePeriods.First(p => p.Style == ipp.Style && p.Value == ipp.Value);

            policy.SetSettingLock("保障期限", true);
            policy.SetSettingLock("缴费期限", true);
            policy.SetSettingLock("Amount", true);
        }
    }
}
